//
//  OrderInfoFooterView.m
//  Findif
//
//  Created by Mac on 2018/12/19.
//  Copyright © 2018年 Cicel Chen. All rights reserved.
//

#import "OrderInfoFooterView.h"

@interface OrderInfoFooterView ()

@property (nonatomic, weak)UIView * lineView;


@end

@implementation OrderInfoFooterView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    return self;
}

- (void)setupUI{
    
    self.backgroundColor = ZRWhiteColor;
    self.userInteractionEnabled = YES;
 
    UIButton * callButton = [[UIButton alloc] init];
    //
    [callButton setTitle:@"联系卖家" forState:UIControlStateNormal];
    [callButton setTitleColor:ColorWithRGB(0x53d499) forState:UIControlStateNormal];
    [callButton addTarget:self action:@selector(ClickCallButton) forControlEvents:UIControlEventTouchUpInside];
    callButton.titleLabel.font = [UIFont systemFontOfSize:16 * SCREENH6];
    
    self.callButton = callButton;
    
    [self addSubview:self.callButton];
    
    UIView * lineView = [[UIView alloc] initWithFrame:CGRectMake(10 * SCREENH6, 0, 355 * SCREENH6, 1 * SCREENH6)];
    
    lineView.backgroundColor = ColorWithRGB(0xe4e4e4);
    
    self.lineView = lineView;
    
    [self addSubview:self.lineView];
}

- (void)layoutSubviews{
    
    [self.callButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.top.bottom.mas_equalTo(self);
    }];
}


- (void)ClickCallButton{
    
    NSString * str = [NSString stringWithFormat:@"tel:%@",self.tel];
    
    UIWebView * callWebview = [[UIWebView alloc] init];
    
    [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
    
    [self addSubview:callWebview];
}

@end
